//: Playground - noun: a place where people can play

import UIKit

class Car {
    var name : String = ""
    // unowned 不能修饰可选类型
    weak var owner : Person?
    deinit {
        print("car 销毁")
    }
}

class Person {
    var name : String = ""
    var car : Car?
    deinit {
        print("person 销毁")
    }
}

var p : Person? = Person()
p!.name = "Alex"

var c : Car? = Car()
c!.owner = p
p!.car = c

p = nil
c = nil
